All Questions
Tagged with text-formattinggrep
28 questions
1vote
2answers
241views
Recursive pattern search - output formating: for each match file print out the specific file name "\n", line number, sentence matched "\n" in colors
I want a file content search command, under Linux so that: it will search on specified files, e.g: md, txt, htm. recursively from the folder and its subfolders, e.g: . the content search can be ...
-3votes
2answers
2kviews
awk - print second column if 4 and 5 column had a matching words
I have a txt file with 5 columns, like this for example F1 rsfldo4pw F5 ABC POG F2 rsfcl2eou F6 ABD POF F3 rsfceleou F7 ABG POE I want a result of a text file that print the word in column 2 if ...
1vote
1answer
41views
Match contents of first file with second to generate third file
Sample data of my first file first.txt is below: 10.0.0.1,Web Server,comments1,jboss is older version,myappcode1 10.0.0.3,Web Server,comments4,httpd is latest version,myappcode15 10.0.0.7,Web Server,...
-1votes
1answer
2kviews
grep and re-direct to csv
This is the campaign log that I am parsing. Based on call-id I do grep. Orginal Progress-log as follows: FilePlayer::run:: Finished audio file is /voip/VoiceCampaigSetup/wildfly-10.1.0.Final/...
1vote
2answers
323views
Detect odd characters in big text files
I need to check if my entire files contained only 4 characters; "A", "T", "G" and "C". I used to split the characters using sed and then grep -o and -v to ...
2votes
3answers
149views
how to align hypen
This is my command echo -e "Test sur la vie, l'univers et le reste \n " >test42 |grep '42' questions.txt | nl -w1 -s ' - ' | cut -d "/" -f 1 >> test42 this is the output Test sur la vie, ...
0votes
4answers
504views
Extract column starting with uppercase followed by next column starting with lower case
I have a file with multiple columns, separated by an underscore (_). Most of the columns started with an uppercase for the first character, some with lower case. I am intended to extract the string ...
0votes
3answers
2kviews
Extract module name and instance name from verilog/System Verilog file
I have a verilog/System Verilog file from which I want to extract only module_name and instance_name. From following single line: module_name #(.ANY_PARAMETER(.ANY_PARAMETER),.ANY_PARAMETER_1(....
10votes
5answers
3kviews
Bash - draw a vertical line behind lines with variable length
I have a textfile that has the following format and I want to add a vertical line after those lines, followed by increasing numbers: c4-1 d e c c d e c e-2 f g2 e4 f g2 g8-4\( a-5 g f\) e4 c g'8\( a ...
-2votes
4answers
72views
Extracting specific value from a file
I have a sample file like this. Zone A Total Population 500 unit Total Area 150 sq. unit Zone B Total Population 600 unit Total Area 200 sq. unit Zone C Total Population 400 unit Total Area 100 sq. ...
1vote
1answer
656views
How to grep multiple lines?
Grep understands this : curl https://api.coinmarketcap.com/v1/ticker/ | grep "clipper-coin" But not this : curl https://api.coinmarketcap.com/v1/ticker/ | grep "{*clipper-coin*}" The output I ...
11votes
2answers
473views
Delete all lines which don't have n characters before delimiter
I have a very long text file (from here) which should contain 6 hexadecimal characters then a 'break' (which appears as one character and doesn't seem to show up properly in the code markdown below) ...
0votes
1answer
79views
How to filter text, removing lines where a specific position is empty
# lshw -c network -businfo Bus info Device Class Description ======================================================== pci@0000:03:00.0 enp3s0 network I210 Gigabit ...
2votes
2answers
5kviews
Formatting output with printf piped in with xargs
I want to search my code base for ocurrences of a string, and then get the formatted output as filename, line number, and code lide. I got it as I wanted on the first line of the output, but the ...
1vote
3answers
527views
Bash output two results next to each other
I have an out from xmllint and egrep that I would like to print two fields next to each other. e.g. (xmlinput) xmllint --format | egrep reference\|sourcefile <reference>ItemX</reference> &...